package com.sw.youvote.client.services;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sw.youvote.client.QuizListGUI;



public class WocomUserServiceDelegate {
	private WocomUserServiceAsync wocomUserService = GWT.create(WocomUserService.class);
	private QuizListGUI gui;
	
	public void setGUI(QuizListGUI parentGUI){
		gui = parentGUI;
	}
	
	public void getUserName() {
    	wocomUserService.getUserName(
    			
    			new AsyncCallback<String>() {
                    public void onFailure(Throwable caught) {
                        gui.getHeadArea().service_eventGetUserNameFailed(caught);
                    }
        
                    public void onSuccess(String result) {
                    	gui.getHeadArea().service_eventGetUserNameFromService(result);
                        
                        
                    }
    			}//end of inner class
        );//end of listQuizs method call.
    }

	public void pintaCadenaLogin() {

		wocomUserService.pintaCadenaLogin(
    			
    			new AsyncCallback<String>() {
                    public void onFailure(Throwable caught) {
                        gui.getHeadArea().service_eventEstaLogadoFailed(caught);
                    }
        
                    public void onSuccess(String result) {
                    	gui.getHeadArea().service_eventEstaLogadoFromService(result);
                        
                        
                    }
    			}//end of inner class
        );//end of listQuizs method call.
		
	}   
}